#include "pair_tuple.h"
#include "mytools.h"
#include <iostream>
#include <tuple>
#include <utility>

void part_tuple() {
  print_title("tuple and pair");
  {
    // pair 元素 first 和 second
    // std::get<0>(p) 方法
    std::pair<int, std::string> p(42, "hello");
    std::cout << "First: " << p.first << ", Second: " << p.second << std::endl;
    std::cout << "p.get<0>(): " << std::get<0>(p)
              << ", p.get<1>(): " << std::get<1>(p) << std::endl;
    std::cout << "std::get<int>(p): " << std::get<int>(p)
              << ", std::get<std::string>(p): " << std::get<std::string>(p)
              << std::endl;
  }
  {
    // tuple 元素只有get方法
    std::tuple<int, std::string, double> t(42, "hello", 3.14);
    std::cout << "First: " << std::get<0>(t) << ", Second: " << std::get<1>(t)
              << ", Third: " << std::get<2>(t) << std::endl;
  }
}